const Router = require("koa-router");
const { login, success } = require("../controller/auth.controller");
const {
  verifyLogin,
  verifyEmailLogin,
  verifyCellphoneLogin,
  verifyAuth
} = require("../middleware/auth.middleware");
const authRouter = new Router({ prefix: "/login" });
/**
  @route POST /login
  @desc 用户名登录
  @access public
*/
authRouter.post("/", verifyLogin, login);
/**
 @route POST /login/cellphone
 @desc 手机号码登录
 @access public
 */
authRouter.post("/cellphone", verifyCellphoneLogin, login);
/**
 @route POST /login/email
 @desc 邮箱登录
 @access public
 */
authRouter.post("/email", verifyEmailLogin, login);

authRouter.get("/test", verifyAuth, success);
module.exports = authRouter;
